<script setup>
import { ref, defineOptions } from 'vue'
import { Topics } from '@/api/getAxios'


const topics = ref({})
Topics().then((res) => {
    // console.log(res);
    topics.value = res.data.data.list
})

</script>
<template>
    <div class="topics">
        <h1 class="recommend">
            <span>专题</span>
            <span class="iconfont icon-tiaozhuan jump" @click="$router.push('/topicList')"></span>
        </h1>
        <ul>
            <li v-for="item in topics" @click="$router.push(`/topic?id=${item.id}`)">
                <div class="img">
                    <img :src="item.cover" alt="" class="storyCover">
                </div>
            </li>
        </ul>
    </div>
</template>

<style scoped lang='less'>
.topics {
    height: 70vw;
    background-color: #fff;
    margin-bottom: 15px;

    h1 {
        text-align: center;
        font-weight: bold;
        font-size: 22px;
        padding: 20px 0px;
        position: relative;

        span.jump {
            position: absolute;
            right: 0;
            font-size: 26px;
            margin-right: 20px;
        }
    }

    ul {
        display: flex;
        overflow-x: auto;
        height: 45vw;
        width: 95vw;
        margin: 0 auto;

        &::-webkit-scrollbar {
            display: none;
        }

        li {

            border-radius: 5px;
            // border: 1px solid #eee;
            display: flex;
            width: 80vw;
            height: 40vw;
            padding-right: 20px;
            margin-right: 5px;

            .img {
                width: 80vw;
                height: 100%;
                position: relative;
                border-radius: 5px;

                .storyCover {
                    width: 100%;
                    height: 100%;
                    border-radius: 5px;

                }
            }
        }
    }
}
</style>